package library.gui.component;

import java.util.function.Consumer;

import javafx.geometry.Insets;
import javafx.scene.control.Button;
import javafx.scene.layout.GridPane;

public class HButtonList extends GridPane {
	private Button[] all;
	public HButtonList(Button...all) {
		this.all = all;
		this.setPadding(new Insets(5, 10, 5, 10));
		this.setHgap(5);
		this.setVgap(5);
		for(Button x: all) {
			x.prefWidthProperty().bind(this.widthProperty().divide(all.length));
		}
		this.addRow(0, all);
	}
	
	public void foreach(Consumer<? super Button> consumer) {
		for(Button x: all) {
			consumer.accept(x);
		}
	}
}
